<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>华胜后台管理</title>
		<link rel="stylesheet" type="text/css" href="css/unified.css">
		<script src="plugins/layui/layui.js"></script>

		<style type="text/css">
			.searchform span {
				margin-left: 10px
			}
			
			.layui-table-view .layui-table td,
			.layui-table-view .layui-table th {
				padding: 0
			}
		</style>
	</head>

	<body>

		<div class="breadcrumbnav">
			<span class="layui-breadcrumb " lay-separator="·">
          <a ><cite>首页</cite></a>
          <a ><cite>库存管理</cite></a>
          <a ><cite>当前库存</cite></a>
          <a ><cite>库存上限提醒设置</cite></a>
        </span>
		</div>
		<div class="kit-doc">
			<!-- 标题 -->
			<div class="kit-doc-title">
				<fieldset>
					<legend>
						<a name="blockquote">库存产品上限报警</a><span class="titles">仓库:全部仓库</span>
					</legend>
				</fieldset>
			</div>
			<!-- 标题 end-->

			<!-- 概述 -->
			<div class="boderbox">
				<!--<div class="rowtop">
					<button class="layui-btn addbtn">
                  选择仓库
                </button>
					<button class="layui-btn addbtn">
                   修改数量
                </button>

					<form class="layui-form searchform" action="" id="comSearchForm">
						<div class="layui-input-inline">
							<select name="city" lay-verify="">
								<option value="010">条码</option>
								<option value="021">彬彬木业</option>
								<option value="0571" selected>layim</option>
							</select>
						</div>
						<div class="layui-input-inline">
							<input type="text" name="text" required lay-verify="required" placeholder="输入关键字" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-btn-group">
							<button class="layui-btn">搜索</button>
							<button class="layui-btn layui-btn-normal">重置</button>
						</div>
					</form>
				</div>-->

				<div class="layui-tab-content notab">
					<div class="layui-tab-item layui-show">
						<table class="layui-table " lay-filter="table100" id="cctable"></table>

						<!--<table class="layui-table " lay-size="lg" lay-data="{page:'false', id:'commodityclass',height: 'full-30'}" lay-filter="test" id="commodityclass">

							<thead>
								<tr>
									<th lay-data="{field:'a1', width:60}">序号</th>
									<th lay-data="{field:'a2', width:150}">条码</th>
									<th lay-data="{field:'Consignee', width:150}">产品名称</th>
									<th lay-data="{field:'phone', width:100}">库存数量</th>
									<th lay-data="{field:'operation', width:100}">库存上限</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>1</td>
									<td>6948505400029</td>
									<td>那胜牌欧美酸枝</td>
									<td>203</td>
									<td>500</td>
								</tr>

								<tr>
									<td>1</td>
									<td>6948505400029</td>
									<td>那胜牌欧美酸枝</td>
									<td>203</td>
									<td>500</td>
								</tr>
							</tbody>
						</table>-->
					</div>
				</div>


		<script type="text/html" id="titleTpl">
		   {{#  if(d.theNum > d.theNumUpper){ }}
		  库存超出上限
		  {{#  } else { }}
		  库存正常
		  {{#  } }}
		</script>
				<script src="js/jquery-3.2.1.min.js"></script>
				<script type="text/javascript" src="js/allajax.js"></script>
				<script>
					//	$(".stockinTable")
					layui.use(['layer', 'form', 'element', 'table', 'laydate', 'laypage'], function() {
						var layer = layui.layer,
							form = layui.form,
							element = layui.element,
							table = layui.table,
							laydate = layui.laydate,
							laypage = layui.laypage;
						var tableArray = new Array();
						AjaxPostFn('system/repository/select?page=1&pagesize=110', "{}", function(data) {
							if(data.pageInfo.size!=0){
								$.each(data.pageInfo.list, function(idx, obj) {
									var objRep = obj.bizRepository;
									var Vos = obj.bizCommodityVo;
									tableArray.push({
										"id": objRep.id,
										"operation": "<a class='layui-btn ' lay-event='EditThis'>修改库存数量</a>",
										"commodityName": Vos.commodityName,
										"homePhoto": "<img src='" + IMGUrl + '' + Vos.homePhoto + "' alt='分类主图' class='classifyimg'>",
										"theNum":objRep.theNum,
										"theNumUpper": objRep.theNumUpper
										
									});
	
								})
								
								console.log(tableArray)
								//		system/catalog/deletecatalogbyId

							//展示已知数据
							var tableIns = table.render({
								elem: '#cctable',
								cols: [
									[ //标题栏+
										 {field: 'id',minWidth: '0%',width: '0%',type: 'space',style: 'display:none'}, {
											field: 'operation',
											width: 200,
											title: '操作'
										}
										, {
											field: 'commodityName',
											width: 150,
											title: '商品名称'
										},  {
											field: 'homePhoto',
											width: 100,
											title: '主图'
										},{
											field: 'theNum',
											width: 150,
											title: '库存数量'
										},{
											field: 'theNumUpper',
											width: 150,
											title: '商品上限'
										},{
											field: 'stats',
											width: 150,
											title: '状态',
											templet: '#titleTpl'
//											templet: 
//											function(d){
//												return d.theNum > d.theNumUpper ? '库存已达上限'  : '库存正常';
////      return 'ID：'+ d.id +'，标题：<span style="color: #c00;">'+ d.title +'</span>'
//    }
										}

									]
								],
								data: tableArray,
						
								size: 'lg',
								even: true,
								page: true, //是否显示分页
								done:function(){
									 //图片点击放大
				                    TopimgFn();
								}
							});
							}
							
							

						})

					})
				</script>
			</div>
			<!-- 概述 end-->
		</div>
	</body>

</html>